/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package DEMO;
import java.io.IOException;
import javax.websocket.OnClose;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
/**
 *
 * @author martin
 */
@ServerEndpoint("/proceso")
public class Proceso {
  @OnOpen
  public void OnOpen (Session session) {
      System.out.println(session.getId() + "se abrió una conexion");
      try {
          session.getBasicRemote().sendText("conexion establecida");
      } catch (IOException e) {
          e.printStackTrace();
      }
       
  }
  @OnMessage
  public void OnMessage (String message, Session session) {
      System.out.println("Mensaje: " + session.getId() + ": "+message);
      try {
          session.getBasicRemote().sendText(message);
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
  
  @OnClose
  public void OnClose (Session session) {
      System.out.println("Session" + session.getId() + "ha terminado");
  }
  
    
}
